/**
 * Copyright 2010 Tristan Slominski
 *
 * Licensed under the MIT License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.opensource.org/licenses/mit-license.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mindash.handlebars.client.presenters;

import com.mindash.handlebars.shared.actions.DtoRequest;
import com.mindash.handlebars.shared.actions.DtoResponse;
import com.mindash.handlebars.shared.actions.DtosQuery;
import com.mindash.handlebars.shared.model.Dto;
import com.mindash.handlebars.shared.model.DtosQueryResult;

/**
 * @author Tristan Slominski
 * 
 */
public interface DtoPresenter<T extends Dto> extends Presenter {

  /**
   * Fetches the dto from the server.
   * 
   * @param action the request action to execute to fetch the dto
   * @return the returned dto or {@code null}.
   */
  public T fetchDto(DtoRequest action);

  /**
   * Fetches multipled dtos of the same type from the server.
   * 
   * @param action the reqeust query action to execute and get dtos
   * @return the returned query result dto or {@code null}.
   */
  public DtosQueryResult fetchDtosQuery(DtosQuery action);

  /**
   * @param <T> the type of the DTO to return
   * @return the DTO
   */
  public T getDto();

  /**
   * @return the dto response received from the server or null if loading
   */
  public DtoResponse getDtoResponse();

  /**
   * Sets the DTO.
   * 
   * @param <T> the type of the DTO to set
   * @param dto the DTO
   */
  public void setDto(T dto);

}
